package com.dharma.mydiet.storage;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

public class TransactionalRegisterFood {
	private int idRegisterFood;
	private int idFoodValue;
	private int idUser;
	private Date date;
	private float quantity;

	public TransactionalRegisterFood(int idRegisterFood, int idFoodValue, int idUser,
			String date, float quantity) {
		super();
		this.idRegisterFood = idRegisterFood;
		this.idFoodValue = idFoodValue;
		this.idUser = idUser;
		this.setDateFormattedString(date);
		this.quantity = quantity;
	}

	public int getIdRegisterFood() {
		return idRegisterFood;
	}

	public void setIdRegisterFood(int idRegisterFood) {
		this.idRegisterFood = idRegisterFood;
	}

	public int getIdFoodValue() {
		return idFoodValue;
	}

	public void setIdFoodValue(int idFoodValue) {
		this.idFoodValue = idFoodValue;
	}

	public int getIdUser() {
		return idUser;
	}

	public void setIdUser(int idUser) {
		this.idUser = idUser;
	}

	public Date getDate() {
		return date;
	}

	public void setDateFormattedString(String formattedDateString) {
		SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss Z yyyy", new Locale("us"));
		try {
			date = sdf.parse(formattedDateString);
		} catch (ParseException e) {
			System.out.println("Error");
			e.printStackTrace();
		}
	}

	public String getDateFormattedString() {
		return "" + date.toString();
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public float getQuantity() {
		return quantity;
	}

	public void setQuantity(float quantity) {
		this.quantity = quantity;
	}

}
